home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 November / SGI Freeware 1999 November - Disc 1.iso / dist / fw_expect.idb / usr / freeware / catman / u_man / cat1 / libexpect.Z / libexpect
Text File  |  1999-01-26  |  45KB  |  793 lines

  1.  
  2.  
  3.  
  4.      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((11112222 DDDDeeeecccceeeemmmmbbbbeeeerrrr    1111999999991111))))      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       libexpect - programmed dialogue with interactive programs -
  10.       C functions
  11.  
  12.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  13.       This library contains    functions that allow Expect to be used
  14.       as a Tcl extension or    to be used directly from C or C++
  15.       (without Tcl).  Adding Expect    as a Tcl extension is very
  16.       short    and simple, so that will be covered first.
  17.  
  18.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  19.       ####iiiinnnncccclllluuuuddddeeee eeeexxxxppppeeeecccctttt____ttttccccllll....hhhh
  20.       EEEExxxxppppeeeecccctttt____IIIInnnniiiitttt((((iiiinnnntttteeeerrrrpppp))));;;;
  21.  
  22.       cccccccc ffffiiiilllleeeessss............ ----lllleeeexxxxppppeeeecccctttt5555....22220000 ----llllttttccccllll7777....5555 ----llllmmmm
  23.  
  24.       Note:    library    versions may differ in the actual release.
  25.  
  26.       The Expect_Init function adds    expect commands    to the named
  27.       interpreter.    It avoids overwriting commands that already
  28.       exist, however aliases beginning with    "exp_" are always
  29.       created for expect commands.    So for example,    "send" can be
  30.       used as "exp_send".
  31.  
  32.       Generally, you should    only call Expect commands via
  33.       Tcl_Eval.  Certain auxiliary functions may be    called
  34.       directly.  They are summarized below.     They may be useful in
  35.       constructing your own    main.  Look at the file    exp_main_exp.c
  36.       in the Expect    distribution as    a prototype main.  Another
  37.       prototype is tclAppInit.c in the Tcl source distribution.  A
  38.       prototype for    working    with Tk    is in exp_main_tk.c in the
  39.       Expect distribution.
  40.  
  41.       int exp_cmdlinecmds;
  42.       int exp_interactive;
  43.       FILE *exp_cmdfile;
  44.       char *exp_cmdfilename;
  45.       int exp_tcl_debugger_available;
  46.  
  47.       void exp_parse_argv(Tcl_Interp *,int argc,char **argv);
  48.       int  exp_interpreter(Tcl_Interp *);
  49.       void exp_interpret_cmdfile(Tcl_Interp    *,FILE *);
  50.       void exp_interpret_cmdfilename(Tcl_Interp *,char *);
  51.       void exp_interpret_rcfiles(Tcl_Interp    *,int my_rc,int    sys_rc);
  52.       char *    exp_cook(char *s,int *len);
  53.       void (*exp_app_exit)EXP_PROTO((Tcl_Interp *);
  54.       void exp_exit(Tcl_Interp *,int status);
  55.       void exp_exit_handlers(Tcl_Interp *);
  56.       void exp_error(Tcl_Interp,char *,...);
  57.  
  58.       eeeexxxxpppp____ccccmmmmddddlllliiiinnnneeeeccccmmmmddddssss is 1 if Expect has been invoked with
  59.       commands on the program command-line (using "-c" for
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 12/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((11112222 DDDDeeeecccceeeemmmmbbbbeeeerrrr    1111999999991111))))      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))
  71.  
  72.  
  73.  
  74.       example).  eeeexxxxpppp____iiiinnnntttteeeerrrraaaaccccttttiiiivvvveeee is    1 if Expect has    been invoked
  75.       with the -i flag or if no commands or    script is being
  76.       invoked.  eeeexxxxpppp____ccccmmmmddddffffiiiilllleeee    is a stream from which Expect will
  77.       read commands.  eeeexxxxpppp____ccccmmmmddddffffiiiilllleeeennnnaaaammmmeeee is the name of a file    which
  78.       Expect will open and read commands from.
  79.       eeeexxxxpppp____ttttccccllll____ddddeeeebbbbuuuuggggggggeeeerrrr____aaaavvvvaaaaiiiillllaaaabbbblllleeee is    1 if the debugger has been
  80.       armed.
  81.  
  82.       eeeexxxxpppp____ppppaaaarrrrsssseeee____aaaarrrrggggvvvv reads the representation of the command line.
  83.       Based    on what    is found, any of the other variables listed
  84.       here are initialized appropriately.  eeeexxxxpppp____iiiinnnntttteeeerrrrpppprrrreeeetttteeeerrrr
  85.       interactively    prompts    the user for commands and evaluates
  86.       them.     eeeexxxxpppp____iiiinnnntttteeeerrrrpppprrrreeeetttt____ccccmmmmddddffffiiiilllleeee reads the given stream and
  87.       evaluates any    commands found.     eeeexxxxpppp____iiiinnnntttteeeerrrrpppprrrreeeetttt____ccccmmmmddddffffiiiilllleeeennnnaaaammmmeeee
  88.       opens    the named file and evaluates any commands found.
  89.       eeeexxxxpppp____iiiinnnntttteeeerrrrpppprrrreeeetttt____rrrrccccffffiiiilllleeeessss    reads and evalutes the .rc files.  If
  90.       my_rc    is zero, then ~/.expectrc is skipped.  If sys_rc is
  91.       zero,    then the system-wide expectrc file is skipped.
  92.       eeeexxxxpppp____ccccooooooookkkk returns a static buffer containing the argument
  93.       reproduced with newlines replaced by carriage-return
  94.       linefeed sequences.  The primary purpose of this is to allow
  95.       messages to be produced without worrying about whether the
  96.       terminal is in raw mode or cooked mode.  If length is    zero,
  97.       it is    computed via strlen.  eeeexxxxpppp____eeeerrrrrrrroooorrrr    iiiissss aaaa pppprrrriiiinnnnttttffff----lllliiiikkkkeeee
  98.       ffffuuuunnnnccccttttiiiioooonnnn tttthhhhaaaatttt    to interp->result.
  99.  
  100.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  101.       ####iiiinnnncccclllluuuuddddeeee <<<<eeeexxxxppppeeeecccctttt....hhhh>>>>
  102.  
  103.       iiiinnnntttt
  104.       eeeexxxxpppp____ssssppppaaaawwwwnnnnllll((((ffffiiiilllleeee,,,, aaaarrrrgggg0000    [[[[,,,, aaaarrrrgggg1111,,,, ............,,,, aaaarrrrggggnnnn]]]] ((((cccchhhhaaaarrrr ****))))0000))));;;;
  105.       cccchhhhaaaarrrr ****ffffiiiilllleeee;;;;
  106.       cccchhhhaaaarrrr ****aaaarrrrgggg0000,,,, ****aaaarrrrgggg1111,,,, ............ ****aaaarrrrggggnnnn;;;;
  107.  
  108.       iiiinnnntttt
  109.       eeeexxxxpppp____ssssppppaaaawwwwnnnnvvvv((((ffffiiiilllleeee,,,,aaaarrrrggggvvvv))));;;;
  110.       cccchhhhaaaarrrr ****ffffiiiilllleeee,,,, ****aaaarrrrggggvvvv[[[[ ]]]];;;;
  111.  
  112.       iiiinnnntttt
  113.       eeeexxxxpppp____ssssppppaaaawwwwnnnnffffdddd((((ffffdddd))));;;;
  114.       iiiinnnntttt ffffdddd;;;;
  115.  
  116.       FFFFIIIILLLLEEEE ****
  117.       eeeexxxxpppp____ppppooooppppeeeennnn((((ccccoooommmmmmmmaaaannnndddd))));;;;
  118.       cccchhhhaaaarrrr ****ccccoooommmmmmmmaaaannnndddd;;;;
  119.  
  120.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____ppppiiiidddd;;;;
  121.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____ttttttttyyyyiiiinnnniiiitttt;;;;
  122.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____ttttttttyyyyccccooooppppyyyy;;;;
  123.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____ccccoooonnnnssssoooolllleeee;;;;
  124.       eeeexxxxtttteeeerrrrnnnn cccchhhhaaaarrrr ****eeeexxxxpppp____ssssttttttttyyyy____iiiinnnniiiitttt;;;;
  125.       eeeexxxxtttteeeerrrrnnnn vvvvooooiiiidddd ((((****eeeexxxxpppp____cccclllloooosssseeee____iiiinnnn____cccchhhhiiiilllldddd))))(((())));;;;
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 12/23/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((11112222 DDDDeeeecccceeeemmmmbbbbeeeerrrr    1111999999991111))))      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))
  137.  
  138.  
  139.  
  140.       eeeexxxxtttteeeerrrrnnnn vvvvooooiiiidddd ((((****eeeexxxxpppp____cccchhhhiiiilllldddd____eeeexxxxeeeecccc____pppprrrreeeelllluuuuddddeeee))))(((())));;;;
  141.       eeeexxxxtttteeeerrrrnnnn vvvvooooiiiidddd eeeexxxxpppp____cccclllloooosssseeee____ttttccccllll____ffffiiiilllleeeessss(((())));;;;
  142.  
  143.       cccccccc ffffiiiilllleeeessss............ ----lllleeeexxxxppppeeeecccctttt ----llllttttccccllll ----llllmmmm
  144.  
  145.  
  146.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  147.       eeeexxxxpppp____ssssppppaaaawwwwnnnnllll and eeeexxxxpppp____ssssppppaaaawwwwnnnnvvvv fork a new process so that its
  148.       stdin, stdout, and stderr can    be written and read by the
  149.       current process.  _f_i_l_e is the    name of    a file to be executed.
  150.       The _a_r_g pointers are null-terminated strings.     Following the
  151.       style    of execve(), _a_r_g_0 (or _a_r_g_v[_0]) is customarily a
  152.       duplicate of the name    of the file.
  153.  
  154.       Four interfaces are available, eeeexxxxpppp____ssssppppaaaawwwwnnnnllll is useful when the
  155.       number of arguments is known at compile time.     eeeexxxxpppp____ssssppppaaaawwwwnnnnvvvv is
  156.       useful when the number of arguments is not known at compile
  157.       time.     eeeexxxxpppp____ssssppppaaaawwwwnnnnffffdddd is    useful when an open file descriptor is
  158.       already available as a source.  eeeexxxxpppp____ppppooooppppeeeennnn is explained later
  159.       on.
  160.  
  161.       If the process is successfully created, a file descriptor is
  162.       returned which corresponds to    the process's stdin, stdout
  163.       and stderr.  A stream    may be associated with the file
  164.       descriptor by    using fdopen().     (This should almost certainly
  165.       be followed by setbuf() to unbuffer the I/O.)
  166.  
  167.       Closing the file descriptor will typically be    detected by
  168.       the process as an EOF.  Once such a process exits, it    should
  169.       be waited upon (via wait) in order to    free up    the kernel
  170.       process slot.     (Some systems allow you to avoid this if you
  171.       ignore the SIGCHLD signal).
  172.  
  173.       eeeexxxxpppp____ppppooooppppeeeennnn is yet another interface, styled after popen().
  174.       It takes a Bourne shell command line,    and returns a stream
  175.       that corresponds to the process's stdin, stdout and stderr.
  176.       The actual implementation of eeeexxxxpppp____ppppooooppppeeeennnn below demonstrates
  177.       eeeexxxxpppp____ssssppppaaaawwwwnnnnllll.
  178.  
  179.       FILE *
  180.       exp_popen(program)
  181.       char *program;
  182.       {
  183.            FILE *fp;
  184.            int ec;
  185.  
  186.            if (0 > (ec = exp_spawnl("sh","sh","-c",program,(char *)0)))
  187.             return(0);
  188.            if (NULL    == (fp = fdopen(ec,"r+")) return(0);
  189.            setbuf(fp,(char *)0);
  190.            return(fp);
  191.       }
  192.  
  193.  
  194.  
  195.      Page 3                        (printed 12/23/98)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((11112222 DDDDeeeecccceeeemmmmbbbbeeeerrrr    1111999999991111))))      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))
  203.  
  204.  
  205.  
  206.       After    a process is started, the variable eeeexxxxpppp____ppppiiiidddd is set to
  207.       the process-id of the    new process.  The variable
  208.       eeeexxxxpppp____ppppttttyyyy____ssssllllaaaavvvveeee____nnnnaaaammmmeeee is    set to the name    of the slave side of
  209.       the pty.
  210.  
  211.       The spawn functions uses a pty to communicate    with the
  212.       process.  By default,    the pty    is initialized the same    way as
  213.       the user's tty (if possible, i.e., if    the environment    has a
  214.       controlling terminal.)  This initialization can be skipped
  215.       by setting exp_ttycopy to 0.
  216.  
  217.       The pty is further initialized to some system    wide defaults
  218.       if exp_ttyinit is non-zero.  The default is generally
  219.       comparable to    "stty sane".
  220.  
  221.       The tty setting can be further modified by setting the
  222.       variable eeeexxxxpppp____ssssttttttttyyyy____iiiinnnniiiitttt.  This    variable is interpreted    in the
  223.       style    of stty    arguments.  For    example, exp_stty_init =
  224.       "sane"; repeats the default initialization.
  225.  
  226.       On some systems, it is possible to redirect console output
  227.       to ptys.  If this is supported, you can force    the next spawn
  228.       to obtain the    console    output by setting the variable
  229.       eeeexxxxpppp____ccccoooonnnnssssoooolllleeee to 1.
  230.  
  231.       Between the time a process is    started    and the    new program is
  232.       given    control, the spawn functions can clean up the
  233.       environment by closing file descriptors.  By default,    the
  234.       only file descriptors    closed are ones    internal to Expect and
  235.       any marked "close-on-exec".
  236.  
  237.       If needed, you can close additional file descriptors by
  238.       creating an appropriate function and assigning it to
  239.       exp_close_in_child.  The function will be called after the
  240.       fork and before the exec.  (This also    modifies the behavior
  241.       of the spawn command in Expect.)
  242.  
  243.       If you are also using    Tcl, it    may be convenient to use the
  244.       function exp_close_tcl_files which closes all    files between
  245.       the default standard file descriptors    and the    highest
  246.       descriptor known to Tcl.  (Expect does this.)
  247.  
  248.       The function exp_child_exec_prelude is the last function
  249.       called prior to the actual exec in the child.     You can
  250.       redefine this    for effects such as manipulating the uid or
  251.       the signals.
  252.  
  253.  
  254.      IIIIFFFF    YYYYOOOOUUUU WWWWAAAANNNNTTTT TTTTOOOO AAAALLLLLLLLOOOOCCCCAAAATTTTEEEE YYYYOOOOUUUURRRR OOOOWWWWNNNN PPPPTTTTYYYY
  255.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____aaaauuuuttttooooaaaallllllllooooccccppppttttyyyy;;;;
  256.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____ppppttttyyyy[[[[2222]]]];;;;
  257.  
  258.  
  259.  
  260.  
  261.      Page 4                        (printed 12/23/98)
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((11112222 DDDDeeeecccceeeemmmmbbbbeeeerrrr    1111999999991111))))      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))
  269.  
  270.  
  271.  
  272.       The spawn functions use a pty    to communicate with the
  273.       process.  By default,    a pty is automatically allocated each
  274.       time a process is spawned.  If you want to allocate ptys
  275.       yourself, before calling one of the spawn functions, set
  276.       eeeexxxxpppp____aaaauuuuttttooooaaaallllllllooooccccppppttttyyyy to 0, eeeexxxxpppp____ppppttttyyyy[[[[0000]]]] to the master pty file
  277.       descriptor and eeeexxxxpppp____ppppttttyyyy[[[[1111]]]] to the slave pty file descriptor.
  278.       The expect library will not do any pty initializations
  279.       (e.g., exp_stty_init will not    be used).  The slave pty file
  280.       descriptor will be automatically closed when the process is
  281.       spawned.  After the process is started, all further
  282.       communication    takes place with the master pty    file
  283.       descriptor.
  284.  
  285.       eeeexxxxpppp____ssssppppaaaawwwwnnnnllll and eeeexxxxpppp____ssssppppaaaawwwwnnnnvvvv duplicate the shell's actions in
  286.       searching for    an executable file in a    list of    directories.
  287.       The directory    list is    obtained from the environment.
  288.  
  289.      EEEEXXXXPPPPEEEECCCCTTTT PPPPRRRROOOOCCCCEEEESSSSSSSSIIIINNNNGGGG
  290.       While    it is possible to use read() to    read information from
  291.       a process spawned by eeeexxxxpppp____ssssppppaaaawwwwnnnnllll or eeeexxxxpppp____ssssppppaaaawwwwnnnnvvvv, more
  292.       convenient functions are provided.  They are as follows:
  293.  
  294.       iiiinnnntttt
  295.       eeeexxxxpppp____eeeexxxxppppeeeeccccttttllll((((ffffdddd,,,,ttttyyyyppppeeee1111,,,,ppppaaaatttttttteeeerrrrnnnn1111,,,,[[[[rrrreeee1111,,,,]]]],,,,vvvvaaaalllluuuueeee1111,,,,ttttyyyyppppeeee2222,,,,............,,,,eeeexxxxpppp____eeeennnndddd))));;;;
  296.       iiiinnnntttt ffffdddd;;;;
  297.       eeeennnnuuuummmm eeeexxxxpppp____ttttyyyyppppeeee    ttttyyyyppppeeee;;;;
  298.       cccchhhhaaaarrrr ****ppppaaaatttttttteeeerrrrnnnn1111,,,, ****ppppaaaatttttttteeeerrrrnnnn2222,,,, ............;;;;
  299.       rrrreeeeggggeeeexxxxpppp ****rrrreeee1111,,,, ****rrrreeee2222,,,, ............;;;;
  300.       iiiinnnntttt vvvvaaaalllluuuueeee1111,,,, vvvvaaaalllluuuueeee2222,,,, ............;;;;
  301.  
  302.       iiiinnnntttt
  303.       eeeexxxxpppp____ffffeeeexxxxppppeeeeccccttttllll((((ffffpppp,,,,ttttyyyyppppeeee1111,,,,ppppaaaatttttttteeeerrrrnnnn1111,,,,[[[[rrrreeee1111,,,,]]]]vvvvaaaalllluuuueeee1111,,,,ttttyyyyppppeeee2222,,,,............,,,,eeeexxxxpppp____eeeennnndddd))));;;;
  304.       FFFFIIIILLLLEEEE ****ffffpppp;;;;
  305.       eeeennnnuuuummmm eeeexxxxpppp____ttttyyyyppppeeee    ttttyyyyppppeeee;;;;
  306.       cccchhhhaaaarrrr ****ppppaaaatttttttteeeerrrrnnnn1111,,,, ****ppppaaaatttttttteeeerrrrnnnn2222,,,, ............;;;;
  307.       rrrreeeeggggeeeexxxxpppp ****rrrreeee1111,,,, ****rrrreeee2222,,,, ............;;;;
  308.       iiiinnnntttt vvvvaaaalllluuuueeee1111,,,, vvvvaaaalllluuuueeee2222,,,, ............;;;;
  309.  
  310.       eeeennnnuuuummmm eeeexxxxpppp____ttttyyyyppppeeee    {{{{
  311.            eeeexxxxpppp____eeeennnndddd,,,,
  312.            eeeexxxxpppp____gggglllloooobbbb,,,,
  313.            eeeexxxxpppp____eeeexxxxaaaacccctttt,,,,
  314.            eeeexxxxpppp____rrrreeeeggggeeeexxxxpppp,,,,
  315.            eeeexxxxpppp____ccccoooommmmppppiiiilllleeeedddd,,,,
  316.            eeeexxxxpppp____nnnnuuuullllllll,,,,
  317.       }}}};;;;
  318.  
  319.       ssssttttrrrruuuucccctttt eeeexxxxpppp____ccccaaaasssseeee {{{{
  320.            cccchhhhaaaarrrr ****ppppaaaatttttttteeeerrrrnnnn;;;;
  321.            rrrreeeeggggeeeexxxxpppp ****rrrreeee;;;;
  322.            eeeennnnuuuummmm eeeexxxxpppp____ttttyyyyppppeeee ttttyyyyppppeeee;;;;
  323.            iiiinnnntttt vvvvaaaalllluuuueeee;;;;
  324.  
  325.  
  326.  
  327.      Page 5                        (printed 12/23/98)
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((11112222 DDDDeeeecccceeeemmmmbbbbeeeerrrr    1111999999991111))))      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))
  335.  
  336.  
  337.  
  338.       }}}};;;;
  339.  
  340.       iiiinnnntttt
  341.       eeeexxxxpppp____eeeexxxxppppeeeeccccttttvvvv((((ffffdddd,,,,ccccaaaasssseeeessss))));;;;
  342.       iiiinnnntttt ffffdddd;;;;
  343.       ssssttttrrrruuuucccctttt eeeexxxxpppp____ccccaaaasssseeee ****ccccaaaasssseeeessss;;;;
  344.  
  345.       iiiinnnntttt
  346.       eeeexxxxpppp____ffffeeeexxxxppppeeeeccccttttvvvv((((ffffpppp,,,,ccccaaaasssseeeessss))));;;;
  347.       FFFFIIIILLLLEEEE ****ffffpppp;;;;
  348.       ssssttttrrrruuuucccctttt eeeexxxxpppp____ccccaaaasssseeee ****ccccaaaasssseeeessss;;;;
  349.  
  350.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____ttttiiiimmmmeeeeoooouuuutttt;;;;
  351.       eeeexxxxtttteeeerrrrnnnn cccchhhhaaaarrrr ****eeeexxxxpppp____mmmmaaaattttcccchhhh;;;;
  352.       eeeexxxxtttteeeerrrrnnnn cccchhhhaaaarrrr ****eeeexxxxpppp____mmmmaaaattttcccchhhh____eeeennnndddd;;;;
  353.       eeeexxxxtttteeeerrrrnnnn cccchhhhaaaarrrr ****eeeexxxxpppp____bbbbuuuuffffffffeeeerrrr;;;;
  354.       eeeexxxxtttteeeerrrrnnnn cccchhhhaaaarrrr ****eeeexxxxpppp____bbbbuuuuffffffffeeeerrrr____eeeennnndddd;;;;
  355.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____mmmmaaaattttcccchhhh____mmmmaaaaxxxx;;;;
  356.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____ffffuuuullllllll____bbbbuuuuffffffffeeeerrrr;;;;
  357.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____rrrreeeemmmmoooovvvveeee____nnnnuuuullllllllssss;;;;
  358.  
  359.       The functions    wait until the output from a process matches
  360.       one of the patterns, a specified time    period has passed, or
  361.       an EOF is seen.
  362.  
  363.       The first argument to    each function is either    a file
  364.       descriptor or    a stream.  Successive sets of arguments
  365.       describe patterns and    associated integer values to return
  366.       when the pattern matches.
  367.  
  368.       The type argument is one of four values.  exp_end indicates
  369.       that no more patterns    appear.     exp_glob indicates that the
  370.       pattern is a glob-style string pattern.  exp_exact indicates
  371.       that the pattern is an exact string.    exp_regexp indicates
  372.       that the pattern is a    regexp-style string pattern.
  373.       exp_compiled indicates that the pattern is a regexp-style
  374.       string pattern, and that its compiled    form is    also provided.
  375.       exp_null indicates that the pattern is a null    (for debugging
  376.       purposes, a string pattern must also follow).
  377.  
  378.       If the compiled form is not provided with the    functions
  379.       eeeexxxxpppp____eeeexxxxppppeeeeccccttttllll and eeeexxxxpppp____ffffeeeexxxxppppeeeeccccttttllll,    any pattern compilation    done
  380.       internally is    thrown away after the function returns.     The
  381.       functions eeeexxxxpppp____eeeexxxxppppeeeeccccttttvvvv    and eeeexxxxpppp____ffffeeeexxxxppppeeeeccccttttvvvv will automatically
  382.       compile patterns and will not    throw them away.  Instead,
  383.       they must be discarded by the    user, by calling free on each
  384.       pattern.  It is only necessary to discard them, the last
  385.       time the cases are used.
  386.  
  387.       Regexp subpatterns matched are stored    in the compiled
  388.       regexp.  Assuming "re" contains a compiled regexp, the
  389.       matched string can be    found in re->startp[0].     The match
  390.  
  391.  
  392.  
  393.      Page 6                        (printed 12/23/98)
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((11112222 DDDDeeeecccceeeemmmmbbbbeeeerrrr    1111999999991111))))      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))
  401.  
  402.  
  403.  
  404.       substrings (according    to the parentheses) in the original
  405.       pattern can be found in re->startp[1], re->startp[2],    and so
  406.       on, up to re->startp[9].  The    corresponding strings ends are
  407.       re->endp[x] where x is that same index as for    the string
  408.       start.
  409.  
  410.       The type exp_null matches if a null appears in the input.
  411.       The variable exp_remove_nulls    must be    set to 0 to prevent
  412.       nulls    from being automatically stripped.  By default,
  413.       exp_remove_nulls is set to 1 and nulls are automatically
  414.       stripped.
  415.  
  416.       eeeexxxxpppp____eeeexxxxppppeeeeccccttttvvvv and eeeexxxxpppp____ffffeeeexxxxppppeeeeccccttttvvvv are useful when the number of
  417.       patterns is not known    in advance.  In    this case, the sets
  418.       are provided in an array.  The end of    the array is denoted
  419.       by a struct exp_case with type exp_end.  For the rest    of
  420.       this discussion, these functions will    be referred to
  421.       generically as _e_x_p_e_c_t.
  422.  
  423.       If a pattern matches,    then the corresponding integer value
  424.       is returned.    Values need not    be unique, however they    should
  425.       be positive to avoid being mistaken for EXP_EOF,
  426.       EXP_TIMEOUT, or EXP_FULLBUFFER.  Upon    EOF or timeout,    the
  427.       value    EEEEXXXXPPPP____EEEEOOOOFFFF    or EEEEXXXXPPPP____TTTTIIIIMMMMEEEEOOOOUUUUTTTT is returned.  The default
  428.       timeout period is 10 seconds but may be changed by setting
  429.       the variable eeeexxxxpppp____ttttiiiimmmmeeeeoooouuuutttt.  A value of    -1 disables a timeout
  430.       from occurring.  A value of 0    causes the expect function to
  431.       return immediately (i.e., poll) after    one read().  However
  432.       it must be preceded by a function such as select, poll, or
  433.       an event manager callback to guarantee that there is data to
  434.       be read.
  435.  
  436.       If the variable exp_full_buffer is 1,    then EXP_FULLBUFFER is
  437.       returned if exp_buffer fills with no pattern having matched.
  438.  
  439.       When the expect function returns, eeeexxxxpppp____bbbbuuuuffffffffeeeerrrr points to the
  440.       buffer of characters that was    being considered for matching.
  441.       eeeexxxxpppp____bbbbuuuuffffffffeeeerrrr____eeeennnndddd points    to one past the    last character in
  442.       exp_buffer.  If a match occurred, eeeexxxxpppp____mmmmaaaattttcccchhhh points into
  443.       eeeexxxxpppp____bbbbuuuuffffffffeeeerrrr where the match began.  eeeexxxxpppp____mmmmaaaattttcccchhhh____eeeennnndddd points to
  444.       one character    past where the match ended.
  445.  
  446.       Each time new    input arrives, it is compared to each pattern
  447.       in the order they are    listed.     Thus, you may test for
  448.       absence of a match by    making the last    pattern    something
  449.       guaranteed to    appear,    such as    a prompt.  In situations where
  450.       there    is no prompt, you must check for EEEEXXXXPPPP____TTTTIIIIMMMMEEEEOOOOUUUUTTTT (just
  451.       like you would if you    were interacting manually).  More
  452.       philosophy and strategies on specifying eeeexxxxppppeeeecccctttt patterns can
  453.       be found in the documentation    on the eeeexxxxppppeeeecccctttt program itself.
  454.       See SEE ALSO below.
  455.  
  456.  
  457.  
  458.  
  459.      Page 7                        (printed 12/23/98)
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((11112222 DDDDeeeecccceeeemmmmbbbbeeeerrrr    1111999999991111))))      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))
  467.  
  468.  
  469.  
  470.       Patterns are the usual C-shell-style regular expressions.
  471.       For example, the following fragment looks for    a successful
  472.       login, such as from a    telnet dialogue.
  473.  
  474.            switch (exp_expectl(
  475.             exp_glob,"connected",CONN,
  476.             exp_glob,"busy",BUSY,
  477.             exp_glob,"failed",ABORT,
  478.             exp_glob,"invalid password",ABORT,
  479.             exp_end)) {
  480.            case CONN:     /* logged    in successfully    */
  481.             break;
  482.            case BUSY:     /* couldn't log in at the    moment */
  483.             break;
  484.            case EXP_TIMEOUT:
  485.            case ABORT:    /* can't log in at any moment! */
  486.             break;
  487.            default:    /* problem with    expect */
  488.            }
  489.  
  490.       Asterisks (as    in the example above) are a useful shorthand
  491.       for omitting line-termination    characters and other detail.
  492.       Patterns must    match the entire output    of the current process
  493.       (since the previous read on the descriptor or    stream). More
  494.       than 2000 bytes of output can    force earlier bytes to be
  495.       "forgotten".    This may be changed by setting the variable
  496.       eeeexxxxpppp____mmmmaaaattttcccchhhh____mmmmaaaaxxxx.  Note that excessively    large values can slow
  497.       down the pattern matcher.
  498.  
  499.      RRRRUUUUNNNNNNNNIIIINNNNGGGG IIIINNNN    TTTTHHHHEEEE BBBBAAAACCCCKKKKGGGGRRRROOOOUUUUNNNNDDDD
  500.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____ddddiiiissssccccoooonnnnnnnneeeecccctttteeeedddd;;;;
  501.       iiiinnnntttt eeeexxxxpppp____ddddiiiissssccccoooonnnnnnnneeeecccctttt(((())));;;;
  502.  
  503.       It is    possible to move a process into    the background after
  504.       it has begun running.     A typical use for this    is to read
  505.       passwords and    then go    into the background to sleep before
  506.       using    the passwords to do real work.
  507.  
  508.       To move a process into the background, fork, call
  509.       exp_disconnect() in the child    process    and exit() in the
  510.       parent process.  This    disassociates your process from    the
  511.       controlling terminal.     If you    wish to    move a process into
  512.       the background in a different    way, you must set the variable
  513.       exp_disconnected to 1.  This allows processes    spawned    after
  514.       this point to    be started correctly.
  515.  
  516.      MMMMUUUULLLLTTTTIIIIPPPPLLLLEEEEXXXXIIIINNNNGGGG
  517.       By default, the expect functions block inside    of a read on a
  518.       single file descriptor.  If you want to wait on patterns
  519.       from multiple    file descriptors, use select, poll, or an
  520.       event    manager.  They will tell you what file descriptor is
  521.       ready    to read.
  522.  
  523.  
  524.  
  525.      Page 8                        (printed 12/23/98)
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((11112222 DDDDeeeecccceeeemmmmbbbbeeeerrrr    1111999999991111))))      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))
  533.  
  534.  
  535.  
  536.       When a file descriptor is ready to read, you can use the
  537.       expect functions to do one and only read by setting timeout
  538.       to 0.
  539.  
  540.      SSSSLLLLAAAAVVVVEEEE CCCCOOOONNNNTTTTRRRROOOOLLLL
  541.       vvvvooooiiiidddd
  542.       eeeexxxxpppp____ssssllllaaaavvvveeee____ccccoooonnnnttttrrrroooollll((((ffffdddd,,,,eeeennnnaaaabbbblllleeee))))
  543.       iiiinnnntttt ffffdddd;;;;
  544.       iiiinnnntttt eeeennnnaaaabbbblllleeee;;;;
  545.  
  546.  
  547.       Pty trapping is normally done    automatically by the expect
  548.       functions.  However, if you want to issue an ioctl, for
  549.       example, directly on the slave device, you should temporary
  550.       disable trapping.
  551.  
  552.       Pty trapping can be controlled with exp_slave_control.  The
  553.       first    argument is the    file descriptor    corresponding to the
  554.       spawned process.  The    second argument    is a 0 if trapping is
  555.       to be    disabled and 1 if it is    to be enabled.
  556.  
  557.  
  558.      EEEERRRRRRRROOOORRRRSSSS
  559.       All functions    indicate errors    by returning -1    and setting
  560.       errno.
  561.  
  562.       Errors that occur after the spawn functions fork (e.g.,
  563.       attempting to    spawn a    non-existent program) are written to
  564.       the process's    stderr,    and will be read by the    first eeeexxxxppppeeeecccctttt.
  565.  
  566.      SSSSIIIIGGGGNNNNAAAALLLLSSSS
  567.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____rrrreeeeaaaaddddiiiinnnngggg;;;;
  568.       eeeexxxxtttteeeerrrrnnnn jjjjmmmmpppp____bbbbuuuuffff eeeexxxxpppp____rrrreeeeaaaaddddeeeennnnvvvv;;;;
  569.  
  570.       eeeexxxxppppeeeecccctttt uses alarm() to timeout, thus if you generate alarms
  571.       during eeeexxxxppppeeeecccctttt, it will timeout prematurely.
  572.  
  573.       Internally, eeeexxxxppppeeeecccctttt calls read() which    can be interrupted by
  574.       signals.  If you define signal handlers, you can choose to
  575.       restart or abort eeeexxxxppppeeeecccctttt's internal read.  The    variable,
  576.       eeeexxxxpppp____rrrreeeeaaaaddddiiiinnnngggg, is true if (and only if)    eeeexxxxppppeeeecccctttt's read has been
  577.       interrupted.    longjmp(exp_readenv,EXP_ABORT) will abort the
  578.       read.     longjmp(exp_readenv,EXP_RESTART) will restart the
  579.       read.
  580.  
  581.      LLLLOOOOGGGGGGGGIIIINNNNGGGG
  582.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____lllloooogggguuuusssseeeerrrr;;;;
  583.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____llllooooggggffffiiiilllleeee____aaaallllllll
  584.       eeeexxxxtttteeeerrrrnnnn FFFFIIIILLLLEEEE ****eeeexxxxpppp____llllooooggggffffiiiilllleeee;;;;
  585.  
  586.       If eeeexxxxpppp____lllloooogggguuuusssseeeerrrr is nonzero, eeeexxxxppppeeeecccctttt sends any output from the
  587.       spawned process to stdout.  Since interactive    programs
  588.  
  589.  
  590.  
  591.      Page 9                        (printed 12/23/98)
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((11112222 DDDDeeeecccceeeemmmmbbbbeeeerrrr    1111999999991111))))      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))
  599.  
  600.  
  601.  
  602.       typically echo their input, this usually suffices to show
  603.       both sides of    the conversation.  If eeeexxxxpppp____llllooooggggffffiiiilllleeee is also
  604.       nonzero, this    same output is written to the stream defined
  605.       by eeeexxxxpppp____llllooooggggffffiiiilllleeee.  If eeeexxxxpppp____llllooooggggffffiiiilllleeee____aaaallllllll is non-zero, eeeexxxxpppp____llllooooggggffffiiiilllleeee
  606.       is written regardless    of the value of    eeeexxxxpppp____lllloooogggguuuusssseeeerrrr.
  607.  
  608.  
  609.      DDDDEEEEBBBBUUUUGGGGGGGGIIIINNNNGGGG
  610.       While    I consider the library to be easy to use, I think that
  611.       the standalone expect    program    is much, much, easier to use
  612.       than working with the    C compiler and its usual edit,
  613.       compile, debug cycle.     Unlike    typical    C programs, most of
  614.       the debugging    isn't getting the C compiler to    accept your
  615.       programs - rather, it    is getting the dialogue    correct.
  616.       Also,    translating scripts from expect    to C is    usually    not
  617.       necessary.  For example, the speed of    interactive dialogues
  618.       is virtually never an    issue.    So please try the standalone
  619.       'expect' program first.  I suspect it    is a more appropriate
  620.       solution for most people than    the library.
  621.  
  622.       Nonetheless, if you feel compelled to    debug in C, here are
  623.       some tools to    help you.
  624.  
  625.       eeeexxxxtttteeeerrrrnnnn iiiinnnntttt eeeexxxxpppp____iiiissss____ddddeeeebbbbuuuuggggggggiiiinnnngggg;;;;
  626.       eeeexxxxtttteeeerrrrnnnn FFFFIIIILLLLEEEE ****eeeexxxxpppp____ddddeeeebbbbuuuuggggffffiiiilllleeee;;;;
  627.  
  628.       While    expect dialogues seem very intuitive, trying to    codify
  629.       them in a program can    reveal many surprises in a program's
  630.       interface.  Therefore    a variety of debugging aids are
  631.       available.  They are controlled by the above variables, all
  632.       0 by default.
  633.  
  634.       Debugging information    internal to eeeexxxxppppeeeecccctttt is sent to stderr
  635.       when eeeexxxxpppp____iiiissss____ddddeeeebbbbuuuuggggggggiiiinnnngggg    is non-zero.  The debugging
  636.       information includes every character received, and every
  637.       attempt made to match    the current input against the
  638.       patterns.  In    addition, non-printable    characters are
  639.       translated to    a printable form.  For example,    a control-C
  640.       appears as a caret followed by a C.  If eeeexxxxpppp____llllooooggggffffiiiilllleeee is non-
  641.       zero,    this information is also written to that stream.
  642.  
  643.       If eeeexxxxpppp____ddddeeeebbbbuuuuggggffffiiiilllleeee is non-zero,    all normal and debugging
  644.       information is written to that stream, regardless of the
  645.       value    of eeeexxxxpppp____iiiissss____ddddeeeebbbbuuuuggggggggiiiinnnngggg.
  646.  
  647.      CCCCAAAAVVVVEEEEAAAATTTTSSSS
  648.       The stream versions of the eeeexxxxppppeeeecccctttt functions are much slower
  649.       than the file    descriptor versions because there is no    way to
  650.       portably read    an unknown number of bytes without the
  651.       potential of timing out.  Thus, characters are read one at a
  652.       time.     You are therefore strongly encouraged to use the file
  653.       descriptor versions of eeeexxxxppppeeeecccctttt    (although, automated versions
  654.  
  655.  
  656.  
  657.      Page 10                        (printed 12/23/98)
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((11112222 DDDDeeeecccceeeemmmmbbbbeeeerrrr    1111999999991111))))      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))
  665.  
  666.  
  667.  
  668.       of interactive programs don't    usually    demand high speed
  669.       anyway).
  670.  
  671.       You can actually get the best    of both    worlds,    writing    with
  672.       the usual stream functions and reading with the file
  673.       descriptor versions of eeeexxxxppppeeeecccctttt    as long    as you don't attempt
  674.       to intermix other stream input functions (e.g., fgetc).  To
  675.       do this, pass    fileno(stream) as the file descriptor each
  676.       time.     Fortunately, there is little reason to    use anything
  677.       but the eeeexxxxppppeeeecccctttt functions when    reading    from interactive
  678.       programs.
  679.  
  680.       There    is no matching exp_pclose to exp_popen (unlike popen
  681.       and pclose).    It only    takes two functions to close down a
  682.       connection (fclose() followed    by waiting on the pid),    but it
  683.       is not uncommon to separate these two    actions    by large time
  684.       intervals, so    the function seems of little value.
  685.  
  686.       If you are running on    a Cray running Unicos (all I know for
  687.       sure from experience), you must run your compiled program as
  688.       root or setuid.  The problem is that the Cray    only allows
  689.       root processes to open ptys. You should observe as much
  690.       precautions as possible:  If you don't need permissions,
  691.       setuid(0) only immediately before calling one    of the spawn
  692.       functions and    immediately set    it back    afterwards.
  693.  
  694.       Normally, ssssppppaaaawwwwnnnn takes    little time to execute.     If you    notice
  695.       spawn    taking a significant amount of time, it    is probably
  696.       encountering ptys that are wedged.  A    number of tests    are
  697.       run on ptys to avoid entanglements with errant processes.
  698.       (These take 10 seconds per wedged pty.)  Running expect with
  699.       the -d option    will show if eeeexxxxppppeeeecccctttt is encountering many ptys
  700.       in odd states.  If you cannot    kill the processes to which
  701.       these    ptys are attached, your    only recourse may be to
  702.       reboot.
  703.  
  704.      BBBBUUUUGGGGSSSS
  705.       The eeeexxxxpppp____ffffeeeexxxxppppeeeecccctttt functions don't work at all under HP-UX - it
  706.       appears to be    a bug in getc.    Follow the advice (above)
  707.       about    using the eeeexxxxpppp____eeeexxxxppppeeeecccctttt functions (which doesn't need to
  708.       call getc).  If you fix the problem (before I    do - please
  709.       check    the latest release) let    me know.
  710.  
  711.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  712.       An alternative to this library is the    eeeexxxxppppeeeecccctttt program.
  713.       eeeexxxxppppeeeecccctttt interprets scripts written in a high-level language
  714.       which    direct the dialogue.  In addition, the user can    take
  715.       control and interact directly    when desired.  If it is    not
  716.       absolutely necessary to write    your own C program, it is much
  717.       easier to use    eeeexxxxppppeeeecccctttt to perform the entire interaction.  It
  718.       is described further in the following    references:
  719.  
  720.  
  721.  
  722.  
  723.      Page 11                        (printed 12/23/98)
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))    UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((11112222 DDDDeeeecccceeeemmmmbbbbeeeerrrr    1111999999991111))))      LLLLIIIIBBBBEEEEXXXXPPPPEEEECCCCTTTT((((3333))))
  731.  
  732.  
  733.  
  734.       "_e_x_p_e_c_t: _C_u_r_i_n_g _T_h_o_s_e    _U_n_c_o_n_t_r_o_l_l_a_b_l_e _F_i_t_s _o_f _I_n_t_e_r_a_c_t_i_v_i_t_y"
  735.       by Don Libes,    Proceedings of the Summer 1990 USENIX
  736.       Conference, Anaheim, California, June    11-15, 1990.
  737.  
  738.       "_U_s_i_n_g _e_x_p_e_c_t    _t_o _A_u_t_o_m_a_t_e _S_y_s_t_e_m _A_d_m_i_n_i_s_t_r_a_t_i_o_n _T_a_s_k_s" by
  739.       Don Libes, Proceedings of the    1990 USENIX Large Installation
  740.       Systems Administration Conference, Colorado Springs,
  741.       Colorado, October 17-19, 1990.
  742.  
  743.       expect(1), alarm(3), read(2),    write(2), fdopen(3),
  744.       execve(2), execvp(3),    longjmp(3), pty(4).
  745.  
  746.       There    are several examples C programs    in the test directory
  747.       of eeeexxxxppppeeeecccctttt's source distribution which    use the    expect
  748.       library.
  749.  
  750.      AAAAUUUUTTTTHHHHOOOORRRR
  751.       Don Libes, libes@nist.gov, National Institute    of Standards
  752.       and Technology
  753.  
  754.      AAAACCCCKKKKNNNNOOOOWWWWLLLLEEEEDDDDGGGGEEEEMMMMEEEENNNNTTTTSSSS
  755.       Thanks to John Ousterhout (UCBerkeley) for supplying the
  756.       pattern matcher.
  757.  
  758.       Design and implementation of the eeeexxxxppppeeeecccctttt library was paid for
  759.       by the U.S. government and is    therefore in the public
  760.       domain.  However the author and NIST would like credit if
  761.       this program and documentation or portions of    them are used.
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.      Page 12                        (printed 12/23/98)
  790.  
  791.  
  792.  
  793.